// 蓝红水壶问题 P115, 8-4
#[derive(Clone,Debug)]
pub struct Red(pub i32);
#[derive(Clone,Debug)]
pub struct Blue(pub i32);

fn check_equal(red:&Red,blue:&Blue)->bool{
    let Red(r_val) = *red;
    let Blue(b_val) = *blue;
    r_val == b_val
}
// fn check_big_or_equal(red:&Red,blue:&Blue)->(bool,bool){
//     let Red(r_val) = *red;
//     let Blue(b_val) = *blue;
//     (r_val > b_val, r_val==b_val)
// }
pub fn pair(reds:&Vec<Red>,blues:&Vec<Blue>)->Vec<(Red,Blue)>{
    let mut vec:Vec<(Red,Blue)> = vec!();
    for red in reds{
        for blue in blues{
            if check_equal(&red, &blue) {
                vec.push(((*red).clone(),(*blue).clone()));
            }
        }
    }
    vec
}
// blues is pivot
/*
* 拿blue当哨兵,使用随机快速排序方法来做
* check_big_or_equal可以撸出 相等的blue red，然后在 细分
*/
// pub fn pair2(reds:Vec<Red>,blues:Vec<Blue>)->Vec<(Red,Blue)>{
//     unimplemented!();
// }
